#pragma once

#ifndef _H_CWINDOWCLASS
#define _H_CWINDOWCLASS

#define MAXVALUESIZE 100
#define MAXKEYSIZE 50

//forward declarations
class CStringKeyCI;
class CSemaphore;
template<class T,class D>class T2List;

struct sProfileEntry
{
	HWND m_Label;
	char m_CaptionText[MAXKEYSIZE+1];
	char m_ValueText[MAXVALUESIZE+1];
};

class CWindowClass
{
private:
	//variables
	int m_CaptionWidth; 
	int m_ValueLabelWidth;
	T2List<CStringKeyCI,sProfileEntry*>* m_pValueList; 

	ATOM registerWindowClass(HINSTANCE hInstance);

	//private member functions
	sProfileEntry* getEntry(char* key);
	void addEntry(char* key, sProfileEntry* entry);

	bool m_visible;

	HWND m_windowHandle;
public:
	CWindowClass();
	~CWindowClass();

	HWND getWindowHandle();
	void setWindowHandle(HWND newWindowHandle);

	T2List<CStringKeyCI,sProfileEntry*>* m_pNewEntryQueue;

	void setValue(char* key, char* format ,... );

	void setValue(char* key, int newValue);
	void setValueString(char* key, char* newValue);

	void setWindowName(char* newName);

	static DWORD WINAPI handleWindow(LPVOID lpParam);

	static LRESULT CALLBACK	callbackProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

	void setVisible(bool newValue);
	void toggleVisible();
};
#endif